/*
 * Copyright：fxsen <br/>
 * Date: 2021/9/23 9:58 <br/>
 * Author: <a href="mailto:fxsen@foxmail.com">fxsen</a>
 */
package com.fxsen.commons.sysmanager.core.mapper;

import com.fxsen.commons.core.base.common.mapper.CommonMapper;
import com.fxsen.commons.sysmanager.core.entity.Menu;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @describe: 系统菜单数据访接口 <br/>
 * @date: 2021/9/23 9:58 <br/>
 * @author: <a href="mailto:fxsen@foxmail.com">fxsen</a>
 */
@Mapper
@Repository
public interface MenuMapper extends CommonMapper<Menu> {
    /**
    *  查询子菜单
    * @param pId 父id
    * @return {@link List}
    * @date 2021/12/8 16:38
    * @author <a href="mailto:fxsen@foxmail.com">fxsen</a> <br/>
    * @version 1.0.0 <br/>
    **/
    @Select("select * from sys_menu where pid = #{pId}")
    List<Menu> findByPid(String pId);
    /**
    * 查询用户的菜单
    * @param userId 用户id
    * @return {@link List}
    * @date 2022/1/23 22:05
    * @author fxsen
    **/
    List<Menu> findByUserId(String userId);
    /**
     * 通过角色查询菜单
     * @param roleId 角色id
     * @return {@link List}
     * @date 2022/1/24 9:38
     * @author fxsen
     **/
    List<Menu> findByRoleId(String roleId);
}
